﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CKS2320.Common.Model
{
    public class DataQueryListModel
    {
        /// <summary>
        /// AorB
        /// </summary>
        public string RunType { get; set; }

        /// <summary>
        /// 产品ID
        /// </summary>
        public string PartCode { get; set; }

        /// <summary>
        /// 全长
        /// </summary>
        public string PartLength { get; set; }

        /// <summary>
        /// 产品数据
        /// </summary>
        public string DetectedType { get; set; }

        /// <summary>
        /// 指标
        /// </summary>
        public bool? Indicator { get; set; }

        /// <summary>
        /// 公差带
        /// </summary>
        public bool? ToleranceZone { get; set; }

        /// <summary>
        /// 测量值
        /// </summary>
        public float? DetectedData { get; set; }

        /// <summary>
        /// 测量用时
        /// </summary>
        public string DetectedTime { get; set; }

        /// <summary>
        /// 测量状态
        /// </summary>
        public bool? DetectedResult { get; set; }

        /// <summary>
        /// 图片显示
        /// </summary>
        public string DetectedImage { get; set; }
    }

    public class DataQueryResponse
    {
        public int? totalOK { get; set; } = 0;
        public int? totalNG { get; set; } = 0;
        public List<DataQueryListModel> list { get; set; } = new();
    }

    public class DataQueryResponseNew
    {
        //已检测
        public int? Detected { get; set; } = 0;

        //OK
        public int? OK { get; set; } = 0;

        //NG
        public int? NG { get; set; } = 0;

        public int? ThicknessNG { get; set; } = 0;
        public int? BOWNG { get; set; } = 0;
        public int? camberNG { get; set; } = 0;

        //public int? totalNG { get; set; } = 0;
        //public List<DataQueryListModel> list { get; set; } = new();
        //A数组
        public List<DataQuery> listA { get; set; } = new();

        //B数组
        public List<DataQuery> listB { get; set; } = new();
    }

    public class ExportQueryModel
    {
        //已检测
        public int? No { get; set; } = 0;

        /// <summary>
        /// 二维码
        /// </summary>
        public string? PartCode { get; set; } = "";

        /// <summary>
        /// bow值
        /// </summary>
        public string? Bow { get; set; } = "";

        /// <summary>
        /// bow结果
        /// </summary>
        public string? BowResult { get; set; } = "";

        /// <summary>
        /// bow通道
        /// </summary>
        public string? BowPassageway { get; set; } = "";

        /// <summary>
        /// bow测试时间
        /// </summary>
        public string? BowTesttime { get; set; } = "";

        /// <summary>
        /// DC最终电流
        /// </summary>
        public string? DcCurrent { get; set; } = "";

        /// <summary>
        /// DC设定电压
        /// </summary>
        public string? DcVoltage { get; set; } = "";

        /// <summary>
        /// DC结果
        /// </summary>
        public string? ResultDc { get; set; } = "";

        /// <summary>
        /// AC电流
        /// </summary>
        public string? AcCurrent { get; set; } = "";

        /// <summary>
        /// AC电压
        /// </summary>
        public string? AcVoltage { get; set; } = "";

        /// <summary>
        /// AC结果
        /// </summary>
        public string? ResultAc { get; set; } = "";

        /// <summary>
        /// pot通道
        /// </summary>
        public string? PotPassageway { get; set; } = "";

        /// <summary>
        /// 耐压测试时间
        /// </summary>
        public string? PotTesttime { get; set; } = "";

        /// <summary>
        /// 总长
        /// </summary>
        public string? TotalLength { get; set; } = "";

        /// <summary>
        /// 总长结果 新增9.3
        /// </summary>
        public string? TotalLengthResult { get; set; } = "";

        /// <summary>
        /// pot最终测试结果
        /// </summary>
        public string? PotFinalJudge { get; set; } = "";

        /// <summary>
        /// 大端垂直数值
        /// </summary>
        public string? BigPosVerticalValue { get; set; } = "";

        /// <summary>
        /// 小端垂直数值
        /// </summary>
        public string? SmallPosVerticalValue { get; set; } = "";

        /// <summary>
        /// 立面拱曲度
        /// </summary>
        public string? Camber { get; set; } = "";

        /// <summary>
        /// 立面拱曲度结果
        /// </summary>
        public string? CamberResult { get; set; } = "";

        /// <summary>
        /// 正面波间距1
        /// </summary>
        public string? FrontScallopPitch1 { get; set; } = "";

        /// <summary>
        /// 正面波间距2
        /// </summary>
        public string? FrontScallopPitch2 { get; set; } = "";

        /// <summary>
        /// 正面波直径1
        /// </summary>
        public string? FrontScallopDiameter1 { get; set; } = "";

        /// <summary>
        /// 正面波直径2
        /// </summary>
        public string? FrontScallopDiameter2 { get; set; } = "";
        /// <summary>
        /// 正面波间距最大值
        /// </summary>
        public string? FrontScallopPitchMax { get; set; } = "";
        /// <summary>
        /// 正面波间距最小值
        /// </summary>
        public string? FrontScallopPitchMin { get; set; } = "";
        /// <summary>
        /// 正面波直径最大值
        /// </summary>
        public string? FrontScallopDiameterMax { get; set; } = "";
        /// <summary>
        /// 正面波直径最小值
        /// </summary>
        public string? FrontScallopDiameterMin { get; set; } = "";

        /// <summary>
        /// 背面波间距1
        /// </summary>
        public string? BackScallopPitch1 { get; set; } = "";

        /// <summary>
        /// 背面波间距2
        /// </summary>
        public string? BackScallopPitch2 { get; set; } = "";

        /// <summary>
        /// 背面波直径1
        /// </summary>
        public string? BackScallopDiameter1 { get; set; } = "";

        /// <summary>
        /// 背面波直径2
        /// </summary>
        public string? BackScallopDiameter2 { get; set; } = "";

        /// <summary>
        /// 背面波间距最大值
        /// </summary>
        public string? BackScallopPitchMax { get; set; } = "";
        /// <summary>
        /// 背面波间距最小值
        /// </summary>
        public string? BackScallopPitchMin { get; set; } = "";
        /// <summary>
        /// 背面波直径最大值
        /// </summary>
        public string? BackScallopDiameterMax { get; set; } = "";
        /// <summary>
        /// 背面波直径最小值
        /// </summary>
        public string? BackScallopDiameterMin { get; set; } = "";

        ///// <summary>
        ///// 背面波间距3
        ///// </summary>
        //public string? BackScallop3Pitch { get; set; }
        ///// <summary>
        ///// 背面波直径3
        ///// </summary>
        //public string? BackScallop3Diameter { get; set; }
        /// <summary>
        /// 正面厚度7 正面最大值
        /// </summary>
        public string? FrontMaxThickness { get; set; } = "";

        /// <summary>
        /// 正面厚度7 正面最小值
        /// </summary>
        public string? FrontMinThickness { get; set; } = "";

        /// <summary>
        /// 背面厚度 背面最大值
        /// </summary>
        public string? BackMaxThickness { get; set; } = "";

        /// <summary>
        /// 背面厚度 背面最小值
        /// </summary>
        public string? BackMinThickness { get; set; } = "";

        /// <summary>
        /// 背面厚度7 正面最小值
        /// </summary>
        public string? BackThickness7 { get; set; } = "";

        /// <summary>
        /// 正面barb到1
        /// </summary>
        public string? FrontBarbLst1 { get; set; } = "";

        /// <summary>
        /// 正面barb到最后
        /// </summary>
        public string? FrontBarbLast { get; set; } = "";

        /// <summary>
        /// 背面barb到1
        /// </summary>
        public string? BackBarbLst1 { get; set; } = "";

        /// <summary>
        /// 背面barb到最后
        /// </summary>
        public string? BackBarbLast { get; set; } = "";

        /// <summary>
        /// Camber通道
        /// </summary>
        public string? CamberPassageway { get; set; } = "";

        /// <summary>
        /// camber测试时间
        /// </summary>
        public string? CamberTesttime { get; set; } = "";

        /// <summary>
        /// BtLS
        /// </summary>
        public string? CrsmallEndDistanceResult { get; set; }

        /// <summary>
        /// BtFS
        /// </summary>
        public string? CrlargeEndDistanceResult { get; set; }

        /// <summary>
        /// FtFS
        /// </summary>
        public string? Crfront1WaveDistanceResult { get; set; }

        /// <summary>
        /// FtLS
        /// </summary>
        public string? Crfront64WaveDistanceResult { get; set; }

        /// <summary>
        /// 最终测试结果OP30
        /// </summary>
        public string? CamberFinalJudge { get; set; } = "";
    }

    public class ExportQueryCount
    {
        public int? No { get; set; }

        //已检测
        public string? DatatimeName { get; set; }

        //OK
        public int? BowCount { get; set; }

        //NG
        public int? BowOK { get; set; }

        public int? BowNG { get; set; }
        public int? hipotCount { get; set; }
        public int? hipotOK { get; set; }
        public int? hipotNG { get; set; }
        public int? CamberCount { get; set; }
        public int? CamberOK { get; set; }
        public int? CamberNG { get; set; }
    }

    public class DataQuery
    {
        //public int? totalOK { get; set; } = 0;
        //public int? totalNG { get; set; } = 0;
        //public List<DataQueryListModel> list { get; set; } = new();
        public string? RunType { get; set; }

        //产品二维码
        public string? PartCode { get; set; }

        //1号检测台ID
        public string? ShapeID { get; set; }

        //BOW
        public string? BOW { get; set; }

        //Hi-pot
        public string? POT { get; set; }

        //2号检测台ID
        public string? VoltagewithstandID { get; set; }

        //3号检测台ID
        public string? ThicknessdetectionID { get; set; }

        //Camber
        public string? Camber { get; set; }

        //总长
        public string? TotalLength { get; set; }

        //Barb到1st波
        public string? Barb1 { get; set; }

        //Barb到last波
        public string? Barb2 { get; set; }

        public string? BackBarb1 { get; set; }

        //Barb到last波
        public string? BackBarb2 { get; set; }

        //膜厚
        public string? Thickness { get; set; }

        //结果
        public string? Result { get; set; }
    }

    public class ThicknessResponse
    {
        //正面
        public string? DetectedTypeFront { get; set; }

        public string? FrontData { get; set; }

        //背面
        public string? DetectedTypeBack { get; set; }

        public string? BackData { get; set; }
    }

    public class HistoryDataTrendsPackResponse
    {
        public List<HistoryDataTrendsPack> bow { get; set; } = new();
        public List<HistoryDataTrendsPack> camble { get; set; } = new();
        public List<HistoryDataTrendsPack> entireLength { get; set; } = new();
    }

    public class HistoryDataTrendsPack
    {
        /// <summary>
        /// 小时
        /// </summary>
        public string hour { get; set; } = string.Empty;

        /// <summary>
        /// 指标
        /// </summary>
        public string indicator { get; set; } = string.Empty;

        /// <summary>
        /// 数据
        /// </summary>
        public List<float?> data { get; set; } = new();
    }

    public class ExportQueryListModel
    {
        /// <summary>
        /// 产品ID
        /// </summary>
        public string PartCode { get; set; } = string.Empty;

        /// <summary>
        /// IP
        /// </summary>
        public string PLCIP { get; set; } = string.Empty;

        /// <summary>
        /// 检测台
        /// </summary>
        public string StationCode { get; set; } = string.Empty;

        /// <summary>
        /// 检测数据
        /// </summary>
        public float? DetectedData { get; set; }

        /// <summary>
        /// 检测类型
        /// </summary>
        public string DetectedType { get; set; } = string.Empty;

        /// <summary>
        /// A/B件
        /// </summary>
        public string Description { get; set; } = string.Empty;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedTime { get; set; }
    }
}